package Entity;

import java.io.Serializable;
import Communication.Client;
import Communication.MessageHandle;



/**
 * This class represent the Company Member entity

 */

public class Worker implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	String WorkerID;		// Unique user ID for each user of the system
	String firstName;
	String lastName;
	String email;
	String username;
	String password;
    int status;		// 0 - User doesn't exist , 1 - User Exists , 2 - Account locked
    int Role;
     
	
	
	
	public Worker()
	{
		
	}
	public Worker(String WorkerID,String username,String firstName,String lastName,String emailAddress,int Role)
	{		
		this.WorkerID=WorkerID;
		this.username=username;
		this.email=emailAddress;
		this.firstName=firstName;
		this.lastName=lastName;
		this.Role=Role;
	}

	public String getWorkerID()
	{
		return this.WorkerID;
	}
	public String getusername()
	{
		return this.username;
	}
	public String getfirstName()
	{
		return this.firstName;
	}
	public String getlastName()
	{
		return this.lastName;
	}
	public String getEmail()
	{
		return this.email;
	}
	
	public int getRole()
	{
		return this.Role;
	}
	
	public int getStatus()
	{
		return this.status;
	}
	
	public String getPassword()
	{
		return this.password;
	}
	
	public void setStatus(int status)
	{
		
	}
	
	
	public void getWorkerFromDB(Client client, String username) 
	{	
		String workerQuery = "SELECT * FROM workers WHERE UserName = " + "\"" + username + "\"";

	//	client.getData(workerQuery, MessageHandle.WORKER, false);
			
		try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
	}
	
	
	
	public void setStatusDB(Client client, int status) 
	{	
		String str;
		
		str = "UPDATE workers SET Status = " +  status + " WHERE ID = " + client.getCurrentWorker().getWorkerID();
//		client.getData(str, MessageHandle.WORKER, true);
	}
	public void setWorkerID(String workerID) {
		this.WorkerID = workerID;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public void setRole(int role) {
		Role = role;
	}	
	
}	
	